<template>
  <div style="margin: 0 auto">
    <el-row :gutter="10">
      <el-col :span="12" :offset="6">

        <div style="text-align: center;padding: 10px">《{{ workOrderInfo.name }}》-详情信息</div>
        <div style="margin: 10px auto;text-align: center">
          <el-button type="primary" size="mini" @click="timeLineVisible=true" align="center">任务时间轴</el-button>
          <el-button type="primary" size="mini" v-if="this.workOrderInfo.status==0&&enterPriseHidden"
                     @click="distributionPerson()" align="center">分配人员
          </el-button>
          <el-button type="primary" size="mini" v-if="this.workOrderInfo.status==5&&enterPriseHidden"
                     @click="examine()"
                     align="center">审核整改时间
          </el-button>
          <el-button type="primary" size="mini" v-if="this.workOrderInfo.status==5&&enterPriseHidden1"
                     @click="fireExamine()"
                     align="center">审核整改时间
          </el-button>
          <el-button type="primary" size="mini" v-if="this.workOrderInfo.status==4&&enterPriseHiddenXz"
                     @click="show5=true"
                     align="center">业主购买物料
          </el-button>
          <el-button type="primary" size="mini" v-if="this.workOrderInfo.status==4&&enterPriseHiddenXz"
                     @click="trustBuy()"
                     align="center">维保代购
          </el-button>
          <el-button type="primary" size="mini" v-if="this.workOrderInfo.status==11&&enterPriseHidden"
                     @click="show5=true"
                     align="center">维保购买物料
          </el-button>
          <el-button type="primary" size="mini" v-if="this.workOrderInfo.status==10&&enterPriseHiddenXz"
                     @click="buyDone"
                     align="center">购买完成
          </el-button>
          <el-button type="primary" size="mini" v-if="this.workOrderInfo.status==12&&enterPriseHidden"
                     @click="buyDone"
                     align="center">购买完成
          </el-button>
          <el-button type="primary" size="mini"
                     v-if="this.workOrderInfo.status>=3&&this.workOrderInfo.status==3&&enterPriseHidden"
                     @click="returnWorkOrder()" align="center">维保工单退回
          </el-button>
          <el-button type="primary" size="mini" v-if="this.workOrderInfo.status==14&&this.enterPriseHiddenXz"
                     @click="examineConfirm()"
                     align="center">通过审核
          </el-button>
          <el-button type="primary" size="mini" v-if="this.workOrderInfo.status==6&&this.enterPriseHidden"
                     @click="wbConfirm()"
                     align="center">通过审核
          </el-button>
          <el-button type="primary" size="mini" v-if="this.workOrderInfo.status==8&&this.enterPriseHidden1"
                     @click="examineConfirm()"
                     align="center">通过审核
          </el-button>
          <el-button type="primary" size="mini" v-if="isUnapproved"
                     @click="unapproved()"
                     align="center">审核不通过
          </el-button>
          <el-button type="primary" size="mini" v-if="this.workOrderInfo.status==8&&this.enterPriseHidden1"
                     @click="show8=true" align="center">继续整改
          </el-button>
          <el-button type="primary" size="mini" v-if="this.workOrderInfo.status==9&&this.enterPriseHidden"
                     @click="show7=true"
                     align="center">选择执行人
          </el-button>
        </div>
        <el-dialog title="维保工单时间轴" :visible.sync="timeLineVisible">
          <el-timeline :reverse="true">
            <el-timeline-item
                v-for="(activity, index) in workOrderInfo.logList"
                :key="index"
                :timestamp="activity.feedBackTime|dateFormat">
              <p>{{ activity.content }}</p>
            </el-timeline-item>
          </el-timeline>
        </el-dialog>
        <el-dialog title="设置整改时间" :visible.sync="show8">
          <el-form :model="inputForm" ref="inputForm" :rules="inputFormRules" label-width="150px">
            <el-form-item label="指定时间" prop="feedbackTime">
              <el-date-picker
                  v-model="inputForm.feedbackTime"
                  type="datetime"
                  placeholder="选择日期时间"
                  style="width: 100%" :picker-options="pickerOptions">
              </el-date-picker>
            </el-form-item>
            <div align="center">
              <el-button type="primary" @click="workOrderContinueToRectify">确定</el-button>
            </div>
          </el-form>
        </el-dialog>
        <el-dialog title="选择执行人" :visible.sync="show7">
          <el-form :model="inputForm" ref="inputForm" :rules="inputFormRules" label-width="150px">
            <el-form-item label="执行人员" prop="executePerson">
              <el-select v-model="inputForm.executePerson" filterable placeholder="请选择执行人员" style="width: 100%">
                <el-option v-for="(item,index) in userList" :key="index" :value="item.ucId"
                           :label="item.name"></el-option>
              </el-select>
            </el-form-item>
            <div align="center">
              <el-button type="primary" @click="inputUserAndTime">确定</el-button>
            </div>
          </el-form>
        </el-dialog>
        <div style="width: 100%" v-if="show6">
          <el-form :model="fireExamineForm" ref="fireExamineForm" label-width="150px">
            <el-form-item label="指定时间" prop="fireAuditTime">
              <el-date-picker
                  v-model="fireExamineForm.fireAuditTime"
                  type="datetime"
                  placeholder="选择日期时间"
                  style="width: 100%" :picker-options="pickerOptions">
              </el-date-picker>
            </el-form-item>
            <el-form-item label="审核意见" prop="fireAuditOpinion">
              <el-input v-model="fireExamineForm.fireAuditOpinion" placeholder="请输入审核意见"
                        style="width: 100%"></el-input>
            </el-form-item>
            <div align="center">
              <el-button type="primary" @click="fireExamineConfirm">确定</el-button>
            </div>
          </el-form>
        </div>
        <el-dialog title="物料购买" :visible.sync="show5">
          <el-form :model="myselfBuyForm" ref="myselfBuyForm" label-width="150px">
            <el-form-item label="指定时间" prop="arrivalTime">
              <el-date-picker
                  v-model="myselfBuyForm.arrivalTime"
                  type="datetime"
                  placeholder="选择日期时间"
                  style="width: 100%" :picker-options="pickerOptions">
              </el-date-picker>
            </el-form-item>
            <el-form-item label="物料描述" prop="arrivalDescribe">
              <el-input v-model="myselfBuyForm.arrivalDescribe" placeholder="请输入物料描述"
                        style="width: 100%"></el-input>
            </el-form-item>
            <div align="center">
              <el-button type="primary" @click="myselfBuy">确定</el-button>
            </div>
          </el-form>
        </el-dialog>
        <div style="width: 100%" v-if="show">
          <el-form :model="personForm" ref="personForm" :rules="personFormRules" label-width="150px">
            <el-form-item label="执行人员" prop="executePerson">
              <el-select v-model="personForm.executePerson"  filterable placeholder="请选择执行人员" style="width:100%">
                <el-option v-for="(item,index) in userList" :key="index" :value="item.ucId"
                           :label="item.name"></el-option>
              </el-select>
            </el-form-item>
            <div align="center">
              <el-button type="primary" @click="updateUser">确定</el-button>
            </div>
          </el-form>
        </div>
        <div style="width: 100%" v-if="show1">
          <el-form :model="feedBackForm" ref="feedBackForm" label-width="150px">
            <el-form-item label="整改时间" prop="feedbackTime">
              <el-date-picker
                  v-model="feedBackForm.feedbackTime"
                  type="datetime"
                  placeholder="选择日期时间"
                  style="width: 100%">
              </el-date-picker>
            </el-form-item>
            <el-form-item label="反馈描述" prop="feedbackRemark">
              <el-input v-model="feedBackForm.feedbackRemark" placeholder="请输入反馈描述"
                        style="width: 100%"></el-input>
            </el-form-item>
            <div align="center">
              <el-button type="primary" @click="feedbackConfirm">确定</el-button>
            </div>
          </el-form>
        </div>
        <div style="width: 100%" v-if="show2">
          <el-form :model="examineForm" ref="examineForm" label-width="150px">
            <el-form-item label="指定时间" prop="examineTime">
              <el-date-picker
                  v-model="examineForm.examineTime"
                  type="datetime"
                  placeholder="选择日期时间"
                  style="width: 100%">
              </el-date-picker>
            </el-form-item>
            <el-form-item label="审核意见" prop="examineOpinion">
              <el-input v-model="examineForm.examineOpinion" placeholder="请输入审核意见"
                        style="width: 100%"></el-input>
            </el-form-item>
            <div align="center">
              <el-button type="primary" @click="continueRectification">确定</el-button>
            </div>
          </el-form>
          　
        </div>
        <!--没用-->
        <div style="width: 100%" v-if="show3">
          <el-form :model="confirmForm" ref="confirmForm" label-width="150px">
            <el-form-item label="*完成图片*" prop="completeUrl">
              <el-upload
                  class="avatar-uploader"
                  :headers="headers"
                  :action="uploadImg"
                  :data="{type:'avatar'}"
                  :show-file-list="false"
                  :on-success="handleAvatarSuccess"
                  :before-upload="beforeAvatarUpload">
                <img v-if="confirmForm.completeUrl&& imgFlag == false" :src="confirmForm.completeUrl"
                     class="avatar">
                <i v-else-if="!confirmForm.completeUrl&& imgFlag == false"
                   class="el-icon-plus avatar-uploader-icon"></i>
                <el-progress v-if="imgFlag == true" type="circle" :percentage="imgUploadPercent"
                             style="margin-top:30px;"></el-progress>
              </el-upload>
            </el-form-item>
            <div align="center">
              <el-button type="primary" @click="continueExecute">确定</el-button>
            </div>
          </el-form>
          　
        </div>
        <div style="width: 100%" v-if="show4">
          <el-form :model="communicateForm" ref="communicateForm" label-width="150px">
            <el-form-item label="需求描述" prop="content">
              <el-input v-model="communicateForm.content" placeholder="如设备需重新购买"
                        style="width: 100%"></el-input>
            </el-form-item>
            <div align="center">
              <el-button type="primary" @click="communicate">确定</el-button>
            </div>
          </el-form>
        </div>
        <el-form :model="workOrderInfo" ref="workOrderInfo" label-width="150px">
          <el-form-item prop="completeUrl" v-if="workOrderInfo.completeUrl!=null">
            <el-image
                style="width: 150px; height: 250px"
                :src="workOrderInfo.completeUrl"
                fit="fill" :preview-src-list="[workOrderInfo.completeUrl]">>
            </el-image>
            <div style="line-height: 44px">维保处置完成图片</div>
          </el-form-item>
          <el-form-item label="工单名称:" prop="name">
            {{ workOrderInfo.name }}
          </el-form-item>
          <el-form-item label="地点:" prop="address">
            {{ workOrderInfo.address }}
          </el-form-item>
          <el-form-item label="异常图片:" prop="abnormalPic" v-if="workOrderInfo.abnormalPic!=null">
            <el-image
                style="width: 150px; height: 250px"
                :src="workOrderInfo.abnormalPic"
                fit="fill" :preview-src-list="[workOrderInfo.abnormalPic]">>
            </el-image>
          </el-form-item>
          <el-form-item label="详情描述:" prop="remark">
            {{ workOrderInfo.remark }}
          </el-form-item>
          <el-form-item label="上报人:" prop="reportPersonName">
            {{ workOrderInfo.reportPersonName }}
          </el-form-item>
          <el-form-item label="上报人联系电话:" prop="reportPersonTel">
            {{ workOrderInfo.reportPersonTel }}
          </el-form-item>
          <el-form-item label="上报时间:" prop="reportTime">
            {{ workOrderInfo.reportTime |dateFormat }}
          </el-form-item>
          <!--        <el-form-item label="区域Id:" prop="regionId">-->
          <!--          {{ workOrderInfo.regionId }}-->
          <!--        </el-form-item>-->
          <el-form-item label="执行人:" prop="executePersonName">
            {{ workOrderInfo.executePersonName }}
          </el-form-item>
          <!--                    <el-form-item label="执行时间:" prop="executeTime">-->
          <!--                        {{ workOrderInfo.executeTime |dateFormat }}-->
          <!--                    </el-form-item>-->
          <el-form-item label="分配时间:" prop="allocateTime">
            {{ workOrderInfo.allocateTime | dateFormat }}
          </el-form-item>
          <el-form-item label="完成时间:" prop="completeTime">
            {{ workOrderInfo.completeTime | dateFormat }}
          </el-form-item>
          <el-form-item label="整改时间:" prop="feedbackTime">
            {{ workOrderInfo.feedbackTime  | dateFormat }}
          </el-form-item>
          <el-form-item label="反馈描述:" prop="feedbackRemark">
            {{ workOrderInfo.feedbackRemark }}
          </el-form-item>
          <!--        <el-form-item label="审核时间:" prop="examineTime">-->
          <!--          {{ workOrderInfo.examineTime }}-->
          <!--        </el-form-item>-->
          <!--        <el-form-item label="审核意见:" prop="examineOpinion">-->
          <!--          {{ workOrderInfo.examineOpinion }}-->
          <!--        </el-form-item>-->
          <!--        <el-form-item label="审核状态:" prop="examineStatus">-->
          <!--          {{ workOrderInfo.examineStatus }}-->
          <!--        </el-form-item>-->
          <el-form-item label="工单状态:" prop="status">
            {{ workOrderInfo.status | stateWorkOrder }}
          </el-form-item>
          <!--        <el-form-item label="完成图片:" prop="completeUrl">-->
          <!--          {{ workOrderInfo.completeUrl }}-->
          <!--        </el-form-item>-->
        </el-form>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import {
  getInWorkOrderVo,
  assignPeople,
  startChangeStatus,
  confirmWorkOrder,
  communicationNeeds,
  confirmEndChangeStatus,
  workOrderContinueToRectify,
  orderUltimateEnd,
  workOrderReturn,
  workOrderWaitingForReview,
  selfBuy,
  trustBuy,
  buyDone,
  maintenanceBuy,
  fireAuditTime,
  inputUserAndTime,
  communicate,
  communicationFinishBecomeContinue, wbConfirm,unapproved
} from "@/api/workOrder";
import {getInUserList} from "@/api/enterprise";
import {getToken} from "@/utils/auth";
import {uploadImg} from "@/api/common";


export default {
  name: "recordsInfo",
  data() {
    return {
      pickerOptions: {
        disabledDate(time) {
          return time.getTime() < Date.now() - 8.64e7;
        }
      },
      timeLineVisible: false,
      workOrderInfo: {},
      personForm: {},
      feedBackForm: {},
      examineForm: {},
      confirmForm: {
        completeUrl: '',
      },
      myselfBuyForm: {
        ucId: this.$route.query.ucId
      },
      fireExamineForm: {
        ucId: this.$route.query.ucId
      },
      inputForm: {
        ucId: this.$route.query.ucId
      },
      communicateForm: {},
      userList: [],
      show: false,
      show1: false,
      show2: false,
      //没用
      show3: false,
      show4: false,
      show5: false,
      show6: false,
      show7: false,
      show8: false,
      uploadImg,
      imgFlag: false,
      imgUploadPercent: 0,
      inputFormRules: {
        executePerson: [{required: true, message: '请选择执行人员', trigger: 'blur'}],
      },
      personFormRules: {
        executePerson: [{required: true, message: '请选择执行人员', trigger: 'blur'}],
      },
      isUnapproved:false
    }
  },
  computed: {
    headers() {
      return {
        'Authorization': getToken()
      }
    },
    enterPriseHidden() {
      let roleCode = this.$store.getters.roleCode;
      return roleCode == "ADMIN" || roleCode == "XT-ADMIN" || roleCode == "WB-ADMIN"
    },
    enterPriseHidden1() {
      let roleCode = this.$store.getters.roleCode;
      return roleCode == "ADMIN" || roleCode == "XT-ADMIN" || roleCode == "ZD-ADMIN" || roleCode == "DD-ADMIN"
    },
    enterPriseHiddenXz() {
      let roleCode = this.$store.getters.roleCode;
      return roleCode == "ADMIN" || roleCode == "XT-ADMIN" || roleCode == "ZD-ADMIN" || roleCode == "DD-ADMIN" || roleCode == "XZ-ADMIN"
    }
  },
  created() {
    this.$nextTick(() => {
      this.getInWorkOrderVo(this.$route.query.ucId)
    });
    this.personForm.ucId = this.$route.query.ucId
    this.feedBackForm.ucId = this.$route.query.ucId
    this.examineForm.ucId = this.$route.query.ucId
    this.confirmForm.ucId = this.$route.query.ucId
    this.communicateForm.workOrderId = this.$route.query.ucId
  },
  methods: {
    unapproved() {
      unapproved({ucId: this.$route.query.ucId}).then(res => {
        this.$notify.success({
          title: '成功',
          message: "审核完成"
        })
        this.getInWorkOrderVo(this.$route.query.ucId)
      })
    },
    isUnapprovedFun(){
      this.isUnapproved=false
      if(this.workOrderInfo.status==14&&this.enterPriseHiddenXz){
        this.isUnapproved = true
      }
      if(this.workOrderInfo.status==6&&this.enterPriseHidden){
        this.isUnapproved = true
      }
      if(this.workOrderInfo.status==8&&this.enterPriseHidden1){
        this.isUnapproved = true
      }
    },
    handleAvatarSuccess(res, file) {
      //图片上传成功
      console.log(res)
      this.imgFlag = false;
      this.confirmForm.completeUrl = res.data;
      console.log(this.confirmForm.completeUrl)
    },
    uploadImgProcess(event, file, fileList) {
      this.imgFlag = true;
      this.imgUploadPercent = file.percentage.toFixed(0);
    },
    beforeAvatarUpload(file) {
      const isJPG = file.type === 'image/jpeg';
      const isLt2M = file.size / 1024 / 1024 < 2;
      if (!isJPG) {
        this.$message.error('上传头像图片只能是 JPG 格式!');
      }
      if (!isLt2M) {
        this.$message.error('上传头像图片大小不能超过 2MB!');
      }
      return isJPG && isLt2M;
    },
    cancelWorkOrder() {
      window.history.back()
    },
    getInWorkOrderVo(val) {
      let loadingInstance = this.$loading({
        target: this.$refs.content,
        text: '数据加载中'
      });
      getInWorkOrderVo({ucId: val}).then(res => {
        this.workOrderInfo = res.data
        this.getInUserList(res.data.maintenanceEnterprise)
        this.isUnapprovedFun()
        loadingInstance.close()
        this.$notify.success({
          title: '成功',
          message: "获取工单成功"
        })
      }).catch(error => {
        loadingInstance.close()
        this.$notify.error({
          title: '失败',
          message: "获取用户信息失败"
        })
      })
    },
    //分配人员
    distributionPerson() {
      this.show = true
    },
    inputUserAndTime() {
      this.$refs['inputForm'].validate(valid => {
        if (valid) {
          inputUserAndTime(this.inputForm).then(res => {
            this.$notify.success({
              title: '成功',
              message: "录入成功"
            })
            // this.workOrderContinueToRectify()
            this.getInWorkOrderVo(this.$route.query.ucId)
            this.show7 = false
            this.inputForm = {}
          }).catch(error => {
            this.$notify.error({
              title: '失败',
              message: "失败"
            })
          })
        }
      })
    },
    myselfBuy() {
      if (this.workOrderInfo.status == 11) {
        maintenanceBuy(this.myselfBuyForm).then(res => {
          this.$notify.success({
            title: '成功',
            message: "物料购买确认"
          })
          this.getInWorkOrderVo(this.$route.query.ucId)
          this.show5 = false
        }).catch(error => {
          this.$notify.error({
            title: '失败',
            message: "失败"
          })
        })
      } else {
        selfBuy(this.myselfBuyForm).then(res => {
          this.$notify.success({
            title: '成功',
            message: "物料购买确认"
          })
          this.getInWorkOrderVo(this.$route.query.ucId)
          this.show5 = false
        }).catch(error => {
          this.$notify.error({
            title: '失败',
            message: "失败"
          })
        })
      }
    },
    trustBuy() {
      trustBuy({ucId: this.$route.query.ucId}).then(res => {
        this.$notify.success({
          title: '成功',
          message: "已确认维保代购"
        })
        this.getInWorkOrderVo(this.$route.query.ucId)
      }).catch(error => {
        this.$notify.error({
          title: '失败',
          message: "失败"
        })
      })
    },
    //购买完成
    buyDone() {
      buyDone({ucId: this.$route.query.ucId}).then(res => {
        this.$notify.success({
          title: '成功',
          message: "购买完成"
        })
        this.getInWorkOrderVo(this.$route.query.ucId)
      }).catch(error => {
        this.$notify.error({
          title: '失败',
          message: "失败"
        })
      })
    },
    //确认收到
    confirm() {
      confirmWorkOrder({ucId: this.$route.query.ucId}).then(res => {
        this.$notify.success({
          title: '成功',
          message: "确认工单完成"
        })
        this.getInWorkOrderVo(this.$route.query.ucId)
        this.show = false
      }).catch(error => {
        this.$notify.error({
          title: '失败',
          message: "失败"
        })
      })
    },
    //开始执行
    startExecute() {
      startChangeStatus({ucId: this.$route.query.ucId}).then(res => {
        this.$notify.success({
          title: '成功',
          message: "开始执行"
        })
        this.getInWorkOrderVo(this.$route.query.ucId)
      }).catch(error => {
        this.$notify.error({
          title: '失败',
          message: "失败"
        })
      })
    },
    //反馈
    feedback() {
      console.log("反馈")
      this.show1 = true
    },
    //反馈确认按钮
    feedbackConfirm() {
      communicationNeeds(this.feedBackForm).then(res => {
        this.$notify.success({
          title: '成功',
          message: "开始执行"
        })
        this.getInWorkOrderVo(this.$route.query.ucId)
        this.show1 = false
        this.feedBackForm = {}
      }).catch(error => {
        this.$notify.error({
          title: '失败',
          message: "失败"
        })
      })
    },
    //没用
    confirmButton() {
      this.show3 = true
    },
    //没用
    confirmComplete() {
      confirmEndChangeStatus({ucId: this.$route.query.ucId}).then(res => {
        this.$notify.success({
          title: '成功',
          message: "确认完成"
        })
        this.getInWorkOrderVo(this.$route.query.ucId)
        this.show3 = false
        this.confirmForm = {}
      }).catch(error => {
        this.$notify.error({
          title: '失败',
          message: "失败"
        })
      })
    },
    //审核
    examine() {
      this.show2 = true
    },
    fireExamine() {
      this.show6 = true
    },
    //业主和消防单位审核确认按钮
    examineConfirm() {
      orderUltimateEnd({ucId: this.$route.query.ucId}).then(res => {
        this.$notify.success({
          title: '成功',
          message: "审核完成"
        })
        this.getInWorkOrderVo(this.$route.query.ucId)
        // this.show2 = false
        // this.show6 = false
        // this.examineForm = {ucId: this.$route.query.ucId}
        // this.fireExamineForm = {ucId: this.$route.query.ucId}
      }).catch(error => {
        this.$notify.error({
          title: '失败',
          message: "失败"
        })
      })
    },
    //维保审核确认按钮
    wbConfirm() {
      wbConfirm({ucId: this.$route.query.ucId}).then(res => {
        this.$notify.success({
          title: '成功',
          message: "审核完成"
        })
        this.getInWorkOrderVo(this.$route.query.ucId)
        // this.show2 = false
        // this.show6 = false
        // this.examineForm = {ucId: this.$route.query.ucId}
        // this.fireExamineForm = {ucId: this.$route.query.ucId}
      }).catch(error => {
        this.$notify.error({
          title: '失败',
          message: "失败"
        })
      })
    },
    //审核整改时间
    fireExamineConfirm() {
      fireAuditTime(this.fireExamineForm).then(res => {
        this.$notify.success({
          title: '成功',
          message: "审核完成"
        })
        this.getInWorkOrderVo(this.$route.query.ucId)
        this.show6 = false
        this.fireExamineForm = {ucId: this.$route.query.ucId}
      }).catch(error => {
        this.$notify.error({
          title: '失败',
          message: "失败"
        })
      })
    },
    //
    continueRectification() {
      workOrderWaitingForReview(this.examineForm).then(res => {
        this.$notify.success({
          title: '成功',
          message: "审核完成"
        })
        this.getInWorkOrderVo(this.$route.query.ucId)
        this.show2 = false
        this.examineForm = {ucId: this.$route.query.ucId}
      }).catch(error => {
        this.$notify.error({
          title: '失败',
          message: "失败"
        })
      })
    },
    //没用
    continueExecute() {
      workOrderContinueToRectify(this.confirmForm).then(res => {
        this.$notify.success({
          title: '成功',
          message: "审核完成"
        })
        this.getInWorkOrderVo(this.$route.query.ucId)
        this.show3 = false
        this.confirmForm = {}
      }).catch(error => {
        this.$notify.error({
          title: '失败',
          message: "失败"
        })
      })
    },
    returnWorkOrder() {
      workOrderReturn({ucId: this.$route.query.ucId}).then(res => {
        this.$notify.success({
          title: '成功',
          message: "已退回"
        })
        this.getInWorkOrderVo(this.$route.query.ucId)

      }).catch(error => {
        this.$notify.error({
          title: '失败',
          message: "失败"
        })
      })
    },
    updateUser() {
      this.$refs['personForm'].validate(valid => {
        if (valid) {
          assignPeople(this.personForm).then(res => {
            this.$notify.success({
              title: '成功',
              message: "分配人员成功"
            })
            this.getInWorkOrderVo(this.$route.query.ucId)
            this.show = false
          }).catch(res => {
            this.$notify.error({
              title: '失败',
              message: res.msg
            })
          })
        }
      })
    },
    comm() {
      this.show4 = true
    },
    communicate() {
      communicate(this.communicateForm).then(res => {
        this.$notify.success({
          title: '成功',
          message: "提需求成功"
        })
        this.getInWorkOrderVo(this.$route.query.ucId)
        this.show4 = false
        this.communicateForm = {workOrderId: this.$route.query.ucId}
      }).catch(res => {
        this.$notify.error({
          title: '失败',
          message: res.msg
        })
      })
    },
    communicationFinishBecomeContinue() {
      communicationFinishBecomeContinue({ucId: this.$route.query.ucId}).then(res => {
        this.$notify.success({
          title: '成功',
          message: "结束沟通成功"
        })
        this.getInWorkOrderVo(this.$route.query.ucId)
        this.show4 = false
      }).catch(res => {
        this.$notify.error({
          title: '失败',
          message: res.msg
        })
      })
    },
    //show8确定按钮
    workOrderContinueToRectify() {
      workOrderContinueToRectify(this.inputForm).then(res => {
        this.$notify.success({
          title: '成功',
          message: "审核完成"
        })
        this.getInWorkOrderVo(this.$route.query.ucId)
        this.show8 = false
        this.inputForm = {}
      }).catch(error => {
        this.$notify.error({
          title: '失败',
          message: "失败"
        })
      })
    },
    getInUserList(val) {
      getInUserList({deleted: false, flagId: val}).then(res => {
        this.userList = res.data
      })
    },
  }
}
</script>

<style>
.avatar-uploader .el-upload {
  border: 1px dashed #d9d9d9;
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.avatar-uploader .el-upload:hover {
  border-color: #409EFF;
}

.avatar-uploader-icon {
  font-size: 28px;
  color: #8c939d;
  width: 149px;
  height: 149px;
  line-height: 149px;
  text-align: center;
}

.avatar {
  width: 149px;
  height: 149px;
  display: block;
}
</style>
